function str = nums_to_c_array_str(nums, N_newline, format_str)
arguments
    nums (1,:) {mustBeNumeric}
    N_newline (1,1) = 10
    format_str string = "%.3f"
end

    str = "";
    N = length(nums);
    idx = 1;
    for item = nums
        if (idx == 1)
            str = str + "{" + newline + "  ";
        end
    
        if (item >= 0)
            str = str + " ";
        end

        temp = num2str(item, format_str);
        for i=1:1:5-length(temp)
            temp = temp + " ";
        end
        str = str + temp;
    
        if (idx ~= N)
            str = str + ",";
        end
            
        if (mod(idx, N_newline) == 0)
            str = str + newline;
            if (idx ~= N)
                str = str + "  ";
            end
        end
        if (idx == N)
            if (mod(N, N_newline) ~= 0)
                str = str + newline;
            end
            str = str + "}";
        end
        idx = idx + 1;
    end
end